package cn.sinata.wanglin.model;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

import cn.sinata.wanglin.utils.ContactUtils;

/**
 *
 * Created by liaoxiang on 16/12/9.
 */

public class Contact {

    @SerializedName("id")
    private String friendID;//手机通讯录页面使用
    private String userID;//通讯录页面使用
    @SerializedName("nickName")
    private String name;
    private String firstChar;
    private String headUrl;
    private String account;
    private String housingID;
    private int identical;//是否同小区（0：否，1：是）
    private String phone;
    private int headIndex=-1;
    @SerializedName("applyRecodeID")
    private String applyId;
    @Expose
    private String contactName;
    private int isFriend=-1;//当前好友关系（0：接受 1：验证通过 2：添加 3：等待验证 4：拒绝

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setFirstChar(String firstChar) {
        this.firstChar = firstChar;
    }
    public String getFirstChar(){
        if (firstChar == null) {
            firstChar = ContactUtils.formatNamePy(contactName);
        }
        return firstChar;
    }

    public String getHeadUrl() {
        return headUrl==null?"":headUrl;
    }

    public void setHeadUrl(String headUrl) {
        this.headUrl = headUrl;
    }

    public int getHeadIndex() {
        return headIndex;
    }

    public void setHeadIndex(int headIndex) {
        this.headIndex = headIndex;
    }

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public String getHousingID() {
        return housingID;
    }

    public void setHousingID(String housingID) {
        this.housingID = housingID;
    }

    public String getFriendID() {
        return friendID;
    }

    public void setFriendID(String friendID) {
        this.friendID = friendID;
    }

    @Override
    public String toString() {
        return "Contact{" +
                "friendID='" + friendID + '\'' +
                ", name='" + name + '\'' +
                ", firstChar='" + firstChar + '\'' +
                ", headUrl='" + headUrl + '\'' +
                ", account='" + account + '\'' +
                ", housingID='" + housingID + '\'' +
                ", headIndex=" + headIndex +
                '}';
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getContactName() {
        return contactName==null?name:contactName;
    }

    public void setContactName(String contactName) {
        this.contactName = contactName;
    }

    public int getIsFriend() {
        return isFriend;
    }

    public void setIsFriend(int isFriend) {
        this.isFriend = isFriend;
    }

    public String getActionStr(){
//        String action = "添加";
//        if (isFriend == 0) {
//            action = "接受";
//        } else if (isFriend == 1) {
//            action = "已添加";
//        } else if (isFriend == 3) {
//            action = "待接受";
//        }
        String action = "添加";
        if (isFriend == 0) {
            action = "接受";
        } else if (isFriend == 1) {
            action = "已添加";
        } else if (isFriend == 3) {
            action = "等待验证";
        } else if (isFriend == 4) {
            action = "已拒绝";
        }
        return action;
    }

    public int getIdentical() {
        return identical;
    }

    public void setIdentical(int identical) {
        this.identical = identical;
    }

    public String getApplyId() {
        return applyId;
    }

    public void setApplyId(String applyId) {
        this.applyId = applyId;
    }

    public String getUserID() {
        return userID;
    }

    public void setUserID(String userID) {
        this.userID = userID;
    }
}
